<script type="text/javascript">
	$(function () {
            var singRange = '{{$range}}';
            var tpl_id = '{{$tpl_id}}';
            $.ajax({
                url : '/admin/entity/column/collists/range/'+singRange+'/resources',
                type:'get',
                cache: false,
                dataType:'json',
                async:true,
                success:function(data){
                    console.log(data);
                    if (data.status) {
                        $(".tpl_id").empty();// jq写法 清楚地区下拉框的所有内容，然后拼接上从后台取出来的数据
                        $("<option value=''>请选择</option>").appendTo(".tpl_id");
                        var reasourceData = data.content;
                        for(var i=0;i<reasourceData.length;i++){
                            //获取reasourceData里面的数据，拼接到select上
                            if (reasourceData[i].id == tpl_id) {
                                $(".tpl_id").append("<option value='"+reasourceData[i].id+"' selected >"+reasourceData[i].title+"</option>");

                            }else{
                                $(".tpl_id").append("<option value='"+reasourceData[i].id+"'>"+reasourceData[i].title+"</option>");
                            }
                        }
                    } else {
                        // layer.msg(data.content, {
                        //     icon: 5
                        // });
                    }

                },
                error: function() {
                    layer.msg("异常！");
                }
            });
        });

</script>
